﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperCalculator;

namespace BigNumberApp
{
    class Program
    {
        static void TestBaseCal1()
        {
            BigNumber num1 = new BigNumber("112233445566778899.02468");
            BigNumber num2 = new BigNumber("123456789.13579");
            BigNumber r1 = num1 + num2;
            BigNumber r2 = num1 - num2;
            BigNumber r3 = num1 * num2;
            BigNumber r4 = num1 / num2;

            Console.WriteLine(num1.ToString() + " + " + num2.ToString() + " = " + r1.ToString());
            Console.WriteLine(num1.ToString() + " - " + num2.ToString() + " = " + r2.ToString());
            Console.WriteLine(num1.ToString() + " * " + num2.ToString() + " = " + r3.ToString());
            Console.WriteLine(num1.ToString() + " / " + num2.ToString() + " = " + r4.ToString());
        }

        static void TestBaseCal2()
        {
            BigNumber n1 = new BigNumber("1.00000");
            BigNumber n2 = new BigNumber("3");
            BigNumber r = n1 / n2;
            Console.WriteLine(r);
        }

        static void TestSqrt()
        {
            BigNumber num1 = new BigNumber("2.1");
            BigNumber r1 = num1.Power(new BigNumber("0.5"), 30);

            BigNumber a1 = new BigNumber("2.1");
            BigNumber a2 = new BigNumber("3.2");
            BigNumber r2 = a1.Power(a2, 20);

            Console.WriteLine("sqrt " + num1.ToString() + " = " + r1.ToString());
            Console.WriteLine("pow " + a1.ToString() + ", " + a2.ToString() + " = " + r2.ToString());

        }

        static void TestTay()
        {
            BigNumber num1 = new BigNumber("3.14159265358939");
            BigNumber s = TaylorFunction.Sine(num1, 10);
            BigNumber c = TaylorFunction.Cosine(num1, 10);
            BigNumber ePi = TaylorFunction.Exp(num1, 10);

            Console.WriteLine("sin " + num1.ToString() + " = " + s.ToString());
            Console.WriteLine("cos " + num1.ToString() + " = " + c.ToString());
            Console.WriteLine("exp " + num1.ToString() + " = " + ePi.ToString());
        }

        static void Main(string[] args)
        {
            TestSqrt();
            Console.WriteLine("\n");
            TestBaseCal1();
            Console.WriteLine("\n");
            //TestBaseCal2();
            TestTay();
            Console.ReadKey();
        }
    }
}
